package cm.iccsoft.android.telecomcost.entities;
import android.text.format.*;

public class DailyThreshold extends Threshold {
	
	private Day day;	

	public DailyThreshold(double d,int dayOfWeek,int weekOfMonth,int month) {
		super(d);	
		day = new Day();
		day.setDayOfWeek(dayOfWeek);
		day.setWeekOfMonth(weekOfMonth);
		day.setMonthOfYear(month);
	}

	public DailyThreshold() {			
	}

	@Override
	public String getType() {		
		return PROP_TYPE;
	}
	
	@Override
	public void setType(String type) {		
	}

	public void setDayOfWeek(int _dayOfWeek) {
		this.day.setDayOfWeek(_dayOfWeek);
	}

	public int getDayOfWeek() {
		return day.getDayOfWeek();
	}

	@Override
	public TimePeriod getPeriod() {		
		return TimePeriod.DAY;
	}

	@Override
	public void setPeriod(TimePeriod _period) {	
		//do nothing, the period is fixed
	}	
	
	@Override
	public String toString() {
		return DateUtils.getDayOfWeekString(day.getDayOfWeek(), DateUtils.LENGTH_LONG) + " ( " + getAmount() + " )";
	}
	
	public static final String PROP_TYPE = "DailyThreshold";

	public CharSequence getDayNameLong() {		
		return DateUtils.getDayOfWeekString(day.getDayOfWeek(),DateUtils.LENGTH_LONG);
	}
	
	public CharSequence getDayNameShort() {		
		return DateUtils.getDayOfWeekString(day.getDayOfWeek(),DateUtils.LENGTH_SHORT);
	}

	public void setWeekOfMonth(int _weekOfMonth) {
		this.day.setWeekOfMonth(_weekOfMonth);
	}

	public int getWeekOfMonth() {
		return day.getWeekOfMonth();
	}

	public void setMonthOfYear(int _monthOfYear) {
		this.day.setMonthOfYear(_monthOfYear);
	}

	public Month getMonth() {
		return new Month(day.getMonthOfYear());
	}
}
